import options33 from '@/assets/config/config33.ts'

const optionsList = [
    options33,
]

const selectKvOptions: SELECT_KV_OPTION[] = []
const selectCharacterOptions: SELECT_KV_OPTION[] = []
const selectOtherOptions: SELECT_KV_OPTION[] = []
const selectALLOptions: SELECT_KV_OPTION[] = []

optionsList.forEach(options => {
    options.forEach(item => {
        switch (item.type) {
            case 'select_kv': {
                item.options.forEach((temp, index) => {
                    console.log(selectALLOptions.length)
                    const newOption = {
                        ...temp,
                        index: selectALLOptions.length,
                        value: selectALLOptions.length,
                        callback: () => {
                            item.callback(temp.value)
                        },
                    }
                    console.log(newOption)
                    selectALLOptions.push(newOption)
                    switch (temp.type) {
                        case 0: {
                            selectKvOptions.push(newOption)
                            break
                        }
                        case 1: {
                            selectCharacterOptions.push(newOption)
                            break
                        }
                        default: {
                            selectOtherOptions.push(newOption)
                        }
                    }
                })
                break
            }
            default: {
                break
            }
        }
    })
})

console.log(selectALLOptions)

export {
    selectKvOptions,
    selectCharacterOptions,
    selectOtherOptions,
    selectALLOptions,
}